package com.ayuer.chapter03;

public class ReverseLinkedListDemo {
    static class Node{
        private Node next;
        private int data;

        public Node(Node next, Integer data) {
            this.next = next;
            this.data = data;
        }

        public Node getNext() {
            return next;
        }

        public void setNext(Node next) {
            this.next = next;
        }

        public int getData() {
            return data;
        }

        public void setData(int data) {
            this.data = data;
        }
    }

    //反转单链表
    public static void main(String[] args) {
        Node n5 =  new Node(null,5);
        Node n4 =  new Node(n5,4);
        Node n3 =  new Node(n4,3);
        Node n2 =  new Node(n3,2);
        Node n1 =  new Node(n2,1);
        //使用哨兵模式
        Node sentinel = new Node(n1,null);
        Node head = new Node(sentinel,null);

        //带头节点的方式，以及带哨兵

    }
}
